package com.zb.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zb.entity.ZjNetworkEmpFieldValOption;
import com.zb.mapper.ZjNetworkEmpFieldValOptionMapper;
import com.zb.service.ZjNetworkEmpFieldValOptionService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 网点人员字段值内容表 服务实现类
 * </p>
 *
 * @author WEN
 * @since 2024-02-01
 */
@Service
public class ZjNetworkEmpFieldValOptionServiceImpl extends ServiceImpl<ZjNetworkEmpFieldValOptionMapper, ZjNetworkEmpFieldValOption> implements ZjNetworkEmpFieldValOptionService {

    // 根据人员ID获取单选/多选内容
    @Override
    public List<ZjNetworkEmpFieldValOption> getByNetworkEmpId(Long custAccId, Long networkEmpId) {
        QueryWrapper<ZjNetworkEmpFieldValOption> wrapper = new QueryWrapper<>();
        wrapper.select("id", "network_emp_field_val_id", "opt_value")
                .eq("cust_acc_id", custAccId)
                .eq("network_emp_id", networkEmpId);
        return this.list(wrapper);
    }

    // 根据人员ID删除字段内容
    @Override
    public void deleteByNetworkEmpId(Long custAccId, Long networkEmpId) {
        QueryWrapper<ZjNetworkEmpFieldValOption> wrapper = new QueryWrapper<>();
        wrapper.eq("cust_acc_id", custAccId).eq("network_emp_id", networkEmpId);
        this.remove(wrapper);
    }
}
